//
//  ViewController.m
//  BlurViewTest
//
//  Created by LaughingZhong on 14/10/16.
//  Copyright (c) 2014年 Laughing. All rights reserved.
//

#import "ViewController.h"
#import "ILTranslucentView.h"
#import <QuartzCore/QuartzCore.h>
#import <CoreGraphics/CoreGraphics.h>

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [scrollView setContentSize:CGSizeMake(self.view.frame.size.width, self.view.frame.size.height*2)];
//    [self initWithILTranslucentView];
    [self initWithVisualEffectView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)initWithILTranslucentView
{
    ILTranslucentView *translucentView = [[ILTranslucentView alloc] initWithFrame:CGRectMake(0.0, (self.view.frame.size.height - 100.0)/2, 320, 100.0)];
    translucentView.translucentAlpha = 1.0;
    translucentView.translucentStyle = UIBarStyleDefault;
    translucentView.translucentTintColor = [UIColor clearColor];
    translucentView.backgroundColor = [UIColor clearColor];
    
    [self.view addSubview:translucentView];
}

- (void)initWithVisualEffectView
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0.0, 30.0, self.view.frame.size.width, 200.0)];
//    [view setBackgroundColor:[UIColor whiteColor]];
//    [view.layer setShadowOffset:CGSizeMake(-2.0, -2.0)];
//    [view.layer setShadowPath:[[UIBezierPath bezierPathWithRect:CGRectMake(0.0, 0.0, view.bounds.size.width + 4.0, view.bounds.size.height + 4.0)] CGPath]];
//    [view.layer setShadowColor:[[UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.5] CGColor]];
//    [view.layer setShadowOpacity:0.5];
    [self.view addSubview:view];
    
    UIVisualEffect *blurEffect;
    blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
    UIVisualEffectView *visualEffectView;
    visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
    
    [visualEffectView setFrame:view.bounds];
    [view addSubview:visualEffectView];
}

@end
